let xhr;
if(window.XMLHttpRequest){
	xhr = new XMLHttpRequest();
}else{
	xhr = new ActiveXObject('Microsoft.XMLHTTP');
}
xhr.timeout=2;
xhr.open("GET","http://localhost:8080/simple/get?mk=慕课网");
console.log(xhr.responseURL);
console.log(xhr.readyState);
xhr.send();
console.log(xhr.readyState);
xhr.onreadystatechange=function(){
	console.log(this.status,this.upload);
	if(this.readyState==4){
		if(this.status===200||this.status===304){
			let reply=this.response;
			let text=this.responseText;
			let xml=this.responseXML;
			console.log(reply,text,xml);
		}else{
			console.log(this.statusText);
			console.log(`ErrorCode: ${this.status}`);
		}
	}
}

xhr.open("POST","http://localhost:8080/simple/post");
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.send("mk=慕课网&class=ajax");
